
!-------------------------------------------------!
!               NEGFC PROGRAM 			  !
!-------------------------------------------------!
!This program is an implementation of the Non     !
! Equilibrium Green Function Formalism to         !
! calculate transport properties in molecular     !
! nanodevices.                                    !
! Written by C. F. A. Negre 2008.                 !
!-------------------------------------------------!

  Program principal

  use gdevice
  use constants
  use control
  use hamiltonian
  use matrixmod
  use gcontacts
  use outcomes
  use integration
	
  implicit none
! write(*,*)kind(1.0d0)

!stop        
  call initialize	
 
  if(coords_logic.EQ.'S') call coords_read()
  
  if(Hread_logic.EQ.'S') call h_read()	 
  
  if(ReadSelfEnergy_logic.EQ.'S') call Self_energy_read_from_file()
  
  if(ReadSelfEnergy_logic.EQ.'N') call Self_energy_read_from_axis()
 
  if(WithDecoherence_logic.EQ.'S') call decoherence_read()

  if(WriteHDeviceMatrix_logic.EQ.'S') call write_H_matrix()

! if(Hmake_logic.EQ.'S') call h_make()
! if(Hfile_logic.EQ.'S') call h_file()
! if(Sfile_logic.EQ.'S') call s_file()
	
  if(UseSMatrix_logic.EQ.'S') call S_read()  

  if(WriteEigenvals_logic.EQ.'S') call eigenvals()

  if(ContactDOS_logic.EQ.'S') call DOS_contact()
  
  if(DeviceDOS_logic.EQ.'S') call DOS_device()


  if(TransmisionFunction_logic.EQ.'S') call transmision_function()

  if(SingleIVPoint_logic.EQ.'S') call IVSinglePoint()

  if(IvsVCurve_logic.EQ.'S') call IvsV_curve()        
      
  if(WriteRhoDeviceMatrix_logic.EQ.'S') call RhoSinglePoint()
   
  if(WriteGDeviceMatrix_logic.EQ.'S') call GSinglePoint() 

  if(WriteHDeviceMatrix_logic.EQ.'S') call write_H_matrix()
      
  if(IvsLCurve_logic.EQ.'S') call IvsL_curve()
		  
  call finalize
	
  end
